package top.cmx.learn.thread.test;

/**
 * @author cmx
 */
public class CarProducter implements Runnable {
    private CarStock carPool;
    private LockCarStock lockCarPool;
    private volatile boolean isRunning = true;

    public CarProducter(CarStock carPool) {
        this.carPool = carPool;
    }

    public CarProducter(LockCarStock lockCarPool) {
        this.lockCarPool = lockCarPool;
    }

    @Override
    public void run() {
        while (isRunning) {
            carPool.productCar();
        }
    }

    /**
     * 停止线程
     */
    public void stop() {
        this.isRunning = false;
    }
}
